package br.com.honorato.util.dao;

import java.io.Serializable;

import javax.persistence.criteria.Predicate;

import br.com.honorato.dao.JpaDAO;

@SuppressWarnings("rawtypes")
public class BetweenFilter implements Serializable
{
	private static final long serialVersionUID = 1L;

	@SuppressWarnings("unchecked")
	public static <T extends Comparable<T>> Object setFilter(String attributeName, T firstValue, T secondValue, JpaDAO objClass)
	{
		Predicate betweenPredicate = objClass.getCriteriaBuilder().between(objClass.getFromRoot().get(attributeName), firstValue, secondValue);
		objClass.getPredicates().add(betweenPredicate);
		return null;
	}
}